package com.ustudy.entity.cms;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.ustudy.core.dao.support.entity.StringIdEntity;

import com.ustudy.entity.commons.PathFile;

/**
 * 文章
 * @author caizh
 *
 */
@SuppressWarnings("serial")
@Entity(name="Article")
@Table(name="CMS_ARTICLE")
public class Article extends StringIdEntity {
	
	@Column(length=1000)
	private String title;
	
	@ManyToOne(cascade={CascadeType.REMOVE},fetch=FetchType.LAZY)
	@JoinColumn(name="HEADIMG_ID")
	private PathFile headimg;
	
	
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String summary;
	
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String body;
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="ARTICLE_TYPE_ID")
	private ArticleType articleType;
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="PAGE_BLOCK_ID")
	private PageBlock pageBlock;
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="PAGE_CHANNEL_ID")
	private PageChannel pageChannel;
	
	private Long createTime=System.currentTimeMillis();
	
	private Long flashTime=System.currentTimeMillis();
	
	private Boolean top=false;
	
	private Boolean hot=false;

	private Boolean remove=false;
	
	private Long sortInfo=System.currentTimeMillis();
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public ArticleType getArticleType() {
		return articleType;
	}

	public void setArticleType(ArticleType articleType) {
		this.articleType = articleType;
	}

	public PageBlock getPageBlock() {
		return pageBlock;
	}

	public void setPageBlock(PageBlock pageBlock) {
		this.pageBlock = pageBlock;
	}


	public Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Long createTime) {
		this.createTime = createTime;
	}

	public Long getFlashTime() {
		return flashTime;
	}

	public void setFlashTime(Long flashTime) {
		this.flashTime = flashTime;
	}

	public Boolean getTop() {
		if(top==null){
			return false;
		}
		return top;
	}

	public void setTop(Boolean top) {
		this.top = top;
	}

	public Boolean getHot() {
		if(hot==null){
			return false;
		}
		return hot;
	}

	public void setHot(Boolean hot) {
		this.hot = hot;
	}

	public PathFile getHeadimg() {
		return headimg;
	}

	public void setHeadimg(PathFile headimg) {
		this.headimg = headimg;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public PageChannel getPageChannel() {
		return pageChannel;
	}

	public void setPageChannel(PageChannel pageChannel) {
		this.pageChannel = pageChannel;
	}

	public Boolean getRemove() {
		return remove;
	}

	public void setRemove(Boolean remove) {
		this.remove = remove;
	}

	public Long getSortInfo() {
		return sortInfo;
	}

	public void setSortInfo(Long sortInfo) {
		this.sortInfo = sortInfo;
	}
	
	
}
